           package com.java.diagnostics.visualizer.impl.axes;
           
           import com.java.diagnostics.visualizer.data.axes.UnitConverter;
           import com.java.diagnostics.visualizer.data.axes.UnitConverterDefinition;
           import java.text.MessageFormat;
           import java.text.NumberFormat;
           
           public abstract class AbstractUnitConverter
             implements UnitConverter
           {
             private NumberFormat numberFormat = NumberFormat.getInstance();
             private static final String DEFAULT_FORMAT_WITH_UNITS_PATTERN = "{0} {1}";
           
             public final String format(double number)
             {
               return formatUnconverted(convert(number));
             }
           
             public final String formatWithUnits(double number)
             {
               return MessageFormat.format(getFormatWithUnitsPattern(), new Object[] { format(number), getUnitName() });
             }
           
             public final String formatUnconvertedWithUnits(double number)
             {
               return MessageFormat.format(getFormatWithUnitsPattern(), new Object[] { formatUnconverted(number), getUnitName() });
             }
           
             public final String getBaseUnitName()
             {
               return getDefinition().getBaseUnitName();
             }
           
             public final String getUnitName()
             {
               return getDefinition().getUnitName();
             }
           
             public double parseUnconverted(String number) {
               try {
                 return Double.parseDouble(number);
               } catch (NumberFormatException localNumberFormatException) {
               }
               return 0.0D;
             }
           
             public String formatUnconverted(double number, int fractionDigits)
             {
               this.numberFormat.setMinimumFractionDigits(fractionDigits);
               this.numberFormat.setMaximumFractionDigits(fractionDigits);
               return this.numberFormat.format(number);
             }
           
             protected String getFormatWithUnitsPattern()
             {
               return "{0} {1}";
             }
           }

